﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using Excel;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Reflection;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_DanhSachSanPhamDoDang : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CmdExit")]
        private System.Windows.Forms.Button _CmdExit;
        [AccessedThroughProperty("CmdGhiSo")]
        private System.Windows.Forms.Button _CmdGhiSo;
        [AccessedThroughProperty("CmdRefesh")]
        private System.Windows.Forms.Button _CmdRefesh;
        [AccessedThroughProperty("Label1")]
        private System.Windows.Forms.Label _Label1;
        [AccessedThroughProperty("Label2")]
        private System.Windows.Forms.Label _Label2;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("updNam")]
        private NumericUpDown _updNam;
        [AccessedThroughProperty("updThang")]
        private NumericUpDown _updThang;
        [AccessedThroughProperty("VSList")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSList;
        private string cFrmNamThang;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;
        private clsSanPhamHoanThanh objHT;

        public Frm_DanhSachSanPhamDoDang()
        {
            base.Load += new EventHandler(this.Frm_DanhSachSanPhamDoDang_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.cFrmNamThang = "";
            this.objHT = new clsSanPhamHoanThanh();
            this.InitializeComponent();
        }

        private void CmdExit_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void CmdGhiSo_Click(object sender, EventArgs e)
        {
            try
            {
                SaveFileDialog dialog = new SaveFileDialog {
                    Filter = "Excel Files|*.xls",
                    Title = "Save an Excel file"
                };
                dialog.ShowDialog();
                if (dialog.FileName != "")
                {
                    this.VSList.SaveExcel(dialog.FileName, "SPDD", FileFlags.IncludeFixedCells);
                    Excel.Application application = new ApplicationClass();
                    Workbook workbook = application.Workbooks.Open(dialog.FileName, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
                    application.Visible = true;
                }
            }
            catch (COMException exception1)
            {
                ProjectData.SetProjectError(exception1);
                COMException exception = exception1;
                MessageBox.Show(exception.Message);
                ProjectData.ClearProjectError();
            }
            catch (Exception exception3)
            {
                ProjectData.SetProjectError(exception3);
                Exception exception2 = exception3;
                MessageBox.Show(exception2.Message);
                ProjectData.ClearProjectError();
            }
        }

        private void CmdRefesh_Click(object sender, EventArgs e)
        {
            this.LoadData();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing && (this.components != null))
                {
                    this.components.Dispose();
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }

        private void Frm_DanhSachSanPhamDoDang_Load(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                this.Cursor = Cursors.Default;
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                this.updThang.Value = new decimal(DateAndTime.Month(DateAndTime.Today));
                this.updNam.Value = new decimal(DateAndTime.Year(DateAndTime.Today));
                this.LoadData();
                this.Cursor = Cursors.Default;
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_DanhSachSanPhamDoDang));
            this.Panel1 = new Panel();
            this.CmdRefesh = new System.Windows.Forms.Button();
            this.CmdExit = new System.Windows.Forms.Button();
            this.CmdGhiSo = new System.Windows.Forms.Button();
            this.VSList = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.Label2 = new System.Windows.Forms.Label();
            this.updNam = new NumericUpDown();
            this.Label1 = new System.Windows.Forms.Label();
            this.updThang = new NumericUpDown();
            this.Panel1.SuspendLayout();
            this.VSList.BeginInit();
            this.updNam.BeginInit();
            this.updThang.BeginInit();
            this.SuspendLayout();
            this.Panel1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel1.Controls.Add(this.Label2);
            this.Panel1.Controls.Add(this.updNam);
            this.Panel1.Controls.Add(this.Label1);
            this.Panel1.Controls.Add(this.updThang);
            this.Panel1.Controls.Add(this.CmdRefesh);
            this.Panel1.Controls.Add(this.CmdExit);
            this.Panel1.Controls.Add(this.CmdGhiSo);
            this.Panel1.Dock = DockStyle.Top;
            System.Drawing.Point point = new System.Drawing.Point(0, 0);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            Size size = new Size(0x3e2, 0x20);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0x10;
            point = new System.Drawing.Point(0x2b5, 3);
            this.CmdRefesh.Location = point;
            this.CmdRefesh.Name = "CmdRefesh";
            size = new Size(0x5f, 0x19);
            this.CmdRefesh.Size = size;
            this.CmdRefesh.TabIndex = 0x13;
            this.CmdRefesh.Text = "&Refresh";
            this.CmdRefesh.UseVisualStyleBackColor = true;
            point = new System.Drawing.Point(0x37f, 3);
            this.CmdExit.Location = point;
            this.CmdExit.Name = "CmdExit";
            size = new Size(0x5f, 0x19);
            this.CmdExit.Size = size;
            this.CmdExit.TabIndex = 0x12;
            this.CmdExit.Text = "&Tho\x00e1t";
            this.CmdExit.UseVisualStyleBackColor = true;
            point = new System.Drawing.Point(0x31a, 3);
            this.CmdGhiSo.Location = point;
            this.CmdGhiSo.Name = "CmdGhiSo";
            size = new Size(0x5f, 0x19);
            this.CmdGhiSo.Size = size;
            this.CmdGhiSo.TabIndex = 0x10;
            this.CmdGhiSo.Text = "&Exel";
            this.CmdGhiSo.UseVisualStyleBackColor = true;
            this.VSList.AllowEditing = false;
            this.VSList.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Light3D;
            this.VSList.ColumnInfo = manager.GetString("VSList.ColumnInfo");
            this.VSList.Cursor = Cursors.Default;
            this.VSList.Dock = DockStyle.Fill;
            this.VSList.ExtendLastCol = true;
            this.VSList.KeyActionEnter = KeyActionEnum.MoveAcross;
            point = new System.Drawing.Point(0, 0x20);
            this.VSList.Location = point;
            this.VSList.Name = "VSList";
            this.VSList.Rows.Count = 1;
            this.VSList.Rows.DefaultSize = 0x11;
            this.VSList.Rows.MinSize = 20;
            this.VSList.SelectionMode = SelectionModeEnum.Row;
            size = new Size(0x3e2, 0x24d);
            this.VSList.Size = size;
            this.VSList.StyleInfo = manager.GetString("VSList.StyleInfo");
            this.VSList.TabIndex = 0x5e;
            this.VSList.VisualStyle = VisualStyle.Office2007Blue;
            this.Label2.AutoSize = true;
            this.Label2.BackColor = Color.Transparent;
            point = new System.Drawing.Point(0x72, 9);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x1d, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 0x17;
            this.Label2.Text = "Năm";
            point = new System.Drawing.Point(0x9f, 6);
            this.updNam.Location = point;
            decimal num = new decimal(new int[] { 0x9c4, 0, 0, 0 });
            this.updNam.Maximum = num;
            num = new decimal(new int[] { 0x7d0, 0, 0, 0 });
            this.updNam.Minimum = num;
            this.updNam.Name = "updNam";
            size = new Size(0x3a, 20);
            this.updNam.Size = size;
            this.updNam.TabIndex = 0x16;
            num = new decimal(new int[] { 0x7d0, 0, 0, 0 });
            this.updNam.Value = num;
            this.Label1.AutoSize = true;
            this.Label1.BackColor = Color.Transparent;
            point = new System.Drawing.Point(5, 9);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(0x26, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 0x15;
            this.Label1.Text = "Th\x00e1ng";
            point = new System.Drawing.Point(0x33, 6);
            this.updThang.Location = point;
            num = new decimal(new int[] { 12, 0, 0, 0 });
            this.updThang.Maximum = num;
            num = new decimal(new int[] { 1, 0, 0, 0 });
            this.updThang.Minimum = num;
            this.updThang.Name = "updThang";
            size = new Size(0x2d, 20);
            this.updThang.Size = size;
            this.updThang.TabIndex = 20;
            num = new decimal(new int[] { 1, 0, 0, 0 });
            this.updThang.Value = num;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x3e2, 0x26d);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.VSList);
            this.Controls.Add(this.Panel1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.Name = "Frm_DanhSachSanPhamDoDang";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "TH-0016";
            this.Text = "DANH SACH SAN PHAM DO DANG";
            this.Panel1.ResumeLayout(false);
            this.Panel1.PerformLayout();
            this.VSList.EndInit();
            this.updNam.EndInit();
            this.updThang.EndInit();
            this.ResumeLayout(false);
        }

        public void LoadData()
        {
            this.cFrmNamThang = this.updNam.Value.ToString().Trim() + LVYModule.sRight("00" + this.updThang.Value.ToString().Trim(), 2);
            this.objHT.KhoaDonVi = modGeneral.H_CLIENT;
            this.objHT.NamThang = this.cFrmNamThang;
            System.Data.DataTable danhSachSanPhamDoDang = this.objHT.GetDanhSachSanPhamDoDang();
            C1.Win.C1FlexGrid.C1FlexGrid vSList = this.VSList;
            vSList.Rows.Count = 1;
            int num4 = danhSachSanPhamDoDang.Rows.Count - 1;
            for (int i = 0; i <= num4; i++)
            {
                vSList.AddItem("");
                vSList[i + 1, 0] = RuntimeHelpers.GetObjectValue(danhSachSanPhamDoDang.Rows[i]["KhoaTaiKhoan"]);
                vSList[i + 1, 1] = RuntimeHelpers.GetObjectValue(danhSachSanPhamDoDang.Rows[i]["SoTaiKhoan"]);
                vSList[i + 1, 2] = RuntimeHelpers.GetObjectValue(danhSachSanPhamDoDang.Rows[i]["BoPhan"]);
                vSList[i + 1, 3] = RuntimeHelpers.GetObjectValue(danhSachSanPhamDoDang.Rows[i]["SanPham"]);
                vSList[i + 1, 4] = RuntimeHelpers.GetObjectValue(danhSachSanPhamDoDang.Rows[i]["HopDong"]);
                vSList[i + 1, 5] = RuntimeHelpers.GetObjectValue(danhSachSanPhamDoDang.Rows[i]["SoDuNoDauKy"]);
                vSList[i + 1, 6] = RuntimeHelpers.GetObjectValue(danhSachSanPhamDoDang.Rows[i]["SoDuCoDauKy"]);
                vSList[i + 1, 7] = RuntimeHelpers.GetObjectValue(danhSachSanPhamDoDang.Rows[i]["SoPhatSinhNo"]);
                vSList[i + 1, 8] = RuntimeHelpers.GetObjectValue(danhSachSanPhamDoDang.Rows[i]["SoPhatSinhCo"]);
                vSList[i + 1, 9] = RuntimeHelpers.GetObjectValue(danhSachSanPhamDoDang.Rows[i]["SoDuNoCuoiKy"]);
                vSList[i + 1, 10] = RuntimeHelpers.GetObjectValue(danhSachSanPhamDoDang.Rows[i]["SoDuCoCuoiKy"]);
            }
            vSList = null;
        }

        internal virtual System.Windows.Forms.Button CmdExit
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdExit;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdExit_Click);
                if (this._CmdExit != null)
                {
                    this._CmdExit.Click -= handler;
                }
                this._CmdExit = value;
                if (this._CmdExit != null)
                {
                    this._CmdExit.Click += handler;
                }
            }
        }

        internal virtual System.Windows.Forms.Button CmdGhiSo
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdGhiSo;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdGhiSo_Click);
                if (this._CmdGhiSo != null)
                {
                    this._CmdGhiSo.Click -= handler;
                }
                this._CmdGhiSo = value;
                if (this._CmdGhiSo != null)
                {
                    this._CmdGhiSo.Click += handler;
                }
            }
        }

        internal virtual System.Windows.Forms.Button CmdRefesh
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdRefesh;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdRefesh_Click);
                if (this._CmdRefesh != null)
                {
                    this._CmdRefesh.Click -= handler;
                }
                this._CmdRefesh = value;
                if (this._CmdRefesh != null)
                {
                    this._CmdRefesh.Click += handler;
                }
            }
        }

        internal virtual System.Windows.Forms.Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual System.Windows.Forms.Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual NumericUpDown updNam
        {
            [DebuggerNonUserCode]
            get
            {
                return this._updNam;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._updNam = value;
            }
        }

        internal virtual NumericUpDown updThang
        {
            [DebuggerNonUserCode]
            get
            {
                return this._updThang;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._updThang = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSList
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSList;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._VSList = value;
            }
        }
    }
}

